#include "distance_transform.h"
namespace contour_trac {
	
	DIST_ARRAY_T Eu_d = { 1,1.41421f,1,1.41421f,1,1.41421f,1,1.41421f };
	DIST_ARRAY_T D4_d = {1,2,1,2,1,2,1,2};
	DIST_ARRAY_T D8_d = { 1,1,1,1,1,1,1,1};
	DIST_ARRAY_VECT DIST_D= { &Eu_d  , &D4_d ,&D8_d };

	float Eu(const int& x1, const int& x2, const int& y1, const int& y2)
	{
		return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
	}

	float D4(const int& x1, const int& x2, const int& y1, const int& y2)
	{
		return abs(x1 - x2) + abs(y1 - y2);
	}

	float D8(const int& x1, const int& x2, const int& y1, const int& y2)
	{
		return std::max(abs(x1 - x2), abs(y1 - y2));
	}

}